{include file=$header_start}
{strip}
<link rel="stylesheet" type="text/css" href="{$siteroot}/templates/default/style/registration.css">
<script type="text/javascript" src="{$siteroot}/includes/js/payment_lead.js"></script>
<script src="{$siteroot}/includes/js/admin/ajax.js" type="text/javascript" ></script>
{/strip}
{include file=$header_end}
{literal}
<script type="text/javascript">


function validateFrm()
{
	
		var isvalid = false;
		isvalid = $("#frmPayment_lead").valid();
		
		
		
		if(isvalid==true)
		{
			var method = $("input[type='radio'][name='paymentmethod']:checked").val();
			if(method =='paypal')
			{
				document.getElementById('btnstep4').value = 'Submit';
				$("#frmPayment_lead").submit();	
			}
			else
			{
				var year = document.getElementById('carddate').value;
				var mon = document.getElementById('cardmonth').value;
				
				// TODAYS DATE
				var today = new Date();
				var todayDate,todayMonth,todayYear;
				todayDate=parseInt(today.getDate());
				todayMonth=parseInt(today.getMonth());
				todayYear=parseInt(today.getFullYear());
				
				var expYears;
				var expMon;
				expYears = parseInt(year);
				expMon = parseInt(mon);
				
				/************ Check valid Security code ************/
				var cc_code = document.getElementById("cardcode").value;			
				var cc_code_lengh = cc_code.length;
				var cc_type = document.getElementById("cardtype").value;
		
				if(cc_type=="")
				{
					document.getElementById('cardtype_msg').innerHTML = "Please Select a type of card.";
					return false;	
				}
		
				if((todayYear == expYears) && (expMon < todayMonth))
				{
					isvalid = false;
					document.getElementById('date_error').innerHTML = "Please Select Proper Expiration Date.";
					document.getElementById('cardmonth').focus();
					return false;
				}		
				else if(cc_type == "Visa" || cc_type == "MasterCard")
				{	
					if(cc_code_lengh != "3")
					{
						document.getElementById("scode_msg").innerHTML = "Please enter valid security code";
						return false;
					}
					else
					{
						isvalid = true;
						document.getElementById('date_error').innerHTML = "";
						document.getElementById("scode_msg").innerHTML = "";
						if(isvalid == true)
						{
								document.getElementById('btnstep4').value = 'Submit';
								$("#frmPayment_lead").submit();
						}
						return true;
					}
				}
				else if(cc_type == "AmEx")
				{
					if(cc_code_lengh != "4")
					{
						document.getElementById("scode_msg").innerHTML = "Please enter valid security code";
						return false;
					}
					else
					{
						isvalid = true;
						document.getElementById('date_error').innerHTML = "";
						document.getElementById("scode_msg").innerHTML = "";
						if(isvalid == true)
						{
								document.getElementById('btnstep4').value = 'Submit';
								$("#frmPayment_lead").submit();
						}
						return true;
					}
				}
				/************ End of Check valid Security code ************/
			}
				
		}
	
}
function showCity(sid){
	ajax.sendrequest("GET",SITEROOT + "/admin/city/show_city.php",{sid:sid},"","isShowCity");
}
function showPostalCode(sid){
	ajax.sendrequest("GET",SITEROOT + "/admin/city/show_postcode.php",{sid:sid},"","isShowPostcode");
}

</script>
{/literal}

   <!-- MIDDLE CONTAIN GOES HERE -->
 
<section class="middle_portion">
	<section class="inner_head">{if $smarty.get.id1 neq ''} Pay Lead Price{else}Membership Plan Renewal{/if}</section>
     {if $sucmsg}<span class="error" >{$sucmsg}</span> {/if}   
    {if $msg}<span class="error" >{$msg}</span> {/if}  
    {if $errorMsg}<div style="padding:5px;"><div class="error_msg" style="width:900px;" > <span>{$errorMsg}</span></div></div>{/if}  
    
    <section class="inner_containstart">  
      
        <section class="buyerinfo"> 
        {if $smarty.get.id1 neq ''}      
           <dl>
            <dt>Lead Price:</dt>
            <dd>{if $smarty.get.id1 neq ''}${$getleadprice.price}{/if}{if $smarty.post.membershipplan neq ''} ${$smarty.post.membershipplan} {/if}</dd>
            <section class="clear"></section>
           </dl>
        {/if}
        {if $smarty.post.membershipplan neq ''}      
	       <dl>
            <dt>Plane Name:</dt>
            <dd>{$getplan_details.name|ucfirst}</dd>
            <section class="clear"></section>
           </dl>
           <dl>
            <dt>Plane Amount:</dt>
            <dd>${$getplan_details.price}</dd>
            <section class="clear"></section>
           </dl>
           <dl>
            <dt>Plane Leads:</dt>
            <dd>{$getplan_details.leads}</dd>
            <section class="clear"></section>
           </dl>
        {/if}
        
        
        </section>  
	
    <section class="regist_form no_bor lF">
    
     <form id="frmPayment_lead" name="frmPayment_lead" method="POST" action ="{$siteroot}/leads/gotopayment/" > 
     {if $smarty.get.id1 neq ''}
     	<input type="hidden" name="leadprice" id="leadprice" value="{$getleadprice.price}" />
        <input type="hidden" name="jobid" id="jobid" value="{$smarty.get.id1}"  /> 
     {/if} 
     {if $smarty.post.membershipplan neq ''}
     	<input type="hidden" name="membershipplan" id="membershipplan" value="{$smarty.post.membershipplan}" />
        <input type="hidden" name="plan_id" id="plan_id" value="{$smarty.post.plan_id}"  /> 
        <input type="hidden" name="jobid" id="jobid" value="{$smarty.post.jobid}"  />         
     {/if}   
     <!--
     <h1 class="payhead">If your Interested then please enter message</h1><br />
     <dl>
        	<dt>Message</dt>
            <dd><textarea class="textarea" name="message" id="message"  style="resize:none;" >{$smarty.post.message}</textarea></dd>
            <section class="clear"></section>
     </dl>  
     <section class="clear"></section>     
     -->
    <h1 class="payhead">Billing Information</h1><br />
   
         <dl>
        	<dt>First  Name</dt>
            <dd><input type="text" class="input" name="cardfirstname" id="cardfirstname" value="{$userDetArray.first_name}" maxlength="20" /></dd>
            <section class="clear"></section>
        </dl>
         <dl>
        	<dt>Last  Name</dt>
            <dd><input type="text" class="input" name="cardllastname" id="cardllastname" value="{$userDetArray.last_name}" maxlength="20"/></dd>
            <section class="clear"></section>
        </dl>
                <dl>
        	<dt>Address Address</dt>
            <dd><input type="text" class="input" name="billingaddr" id="billingaddr" value="{$smarty.post.billingaddr}" maxlength="40"/></dd>
            <section class="clear"></section>
        </dl>
        
        
        <dl>
        	<dt>Country</dt>
              <dd>
              	  <select class="input3" id="country" name="country">
                  		<option value="226">Australia</option>
                  </select></dd>
            <section class="clear"></section>
        </dl>
        <section class="clear"></section>
        <dl>
        	<dt>State/Province</dt>
              <dd>
              	  <select class="input3" id="state" name="state" onchange="showPostalCode(this.value);">
                    <option value="">Select State</option>
                    {section name=i loop=$stateArray}               
		              <option value="{$stateArray[i].state_id}" {if $stateArray[i].state_id eq $smarty.post.state} selected="selected" {/if}>{$stateArray[i].state_name}</option>
        		    {/section}
                          
                  </select>
              </dd>
            <section class="clear"></section>
        </dl>
 		<dl class="space20">
        	<dt>Postal Code</dt>
            <dd>
            <div id="isShowPostcode">	
            	<select class="input20" name="cardpostalcode" id="cardpostalcode"  maxlength="10"/>
                	<option value="">Select a potal code</option>
            	</select>
            </div>
            </dd>
            <section class="clear"></section>
        </dl>                
       <dl class="space30">
        	<dt>City</dt>
            <dd>
            <div id="isShowCity">
            	<select class="input30" id="city" name="city">
                  <option value="">Select City</option>
                   {section name=i loop=$cityArray}
			           <option value="{$cityArray[i].city_id}" {if $cityArray[i].city_id eq $smarty.post.city} selected="selected"{/if}>{$cityArray[i].city_name}</option>
        	       {/section}                                  
                  </select>
               </div>   
            	<!--<input type="text" class="input" name="" id="" value="">-->
            </dd>
            <section class="clear"></section>
        </dl>
      
        
        <section class="clear"></section>
        
        
         <h1 class="payhead">Payment Method</h1>
         <div class="payment">
         {if $paypal.published eq 1}
         	<div class="paypal paymentitem">
            	<input type="radio" name="paymentmethod" value="paypal"  checked="checked" /> <strong>Paypal</strong>
                <p align="center">
                <img src="../../../images/paypal.jpg">
                </p>
                
            </div>
		{/if}
        {if $nab.published eq 1}
         	<div class="nab paymentitem">
            	<input type="radio" name="paymentmethod" value="nab"  /> <strong>NAB</strong><br />
                <div class="nablogo" style="margin-top:10px;">
            	<p align="center">
                	<img src="../../../images/visa_mastercard_logo.gif" height="65" />
                	<img src="../../../images/nab.jpg"  height="65"/>
                </p>
                </div>
                
                
                <dl>
                <dt>Card Type</dt>
                <dd>
                    <select class="input3" id="cardtype" name="cardtype">
                        <option value="">Select Card Type</option>
                        <option value="Visa" {if $smarty.post.cardtype eq 'Visa'} selected="selected" {/if}>VISA </option>
                        <option value="MasterCard" {if $smarty.post.cardtype eq 'MasterCard'} selected="selected" {/if}>Master Card </option>
                        <option value="AmEx" {if $smarty.post.cardtype eq 'AmEx'} selected="selected" {/if}>American Express </option>
                        
                    </select>
                </dd>
                <section class="clear"></section>
                <div style="color:#F00;" id="cardtype_msg"></div>
            </dl>
              
              
                
        <dl>
        	<dt>Card Number</dt>
            <dd><input type="text" class="input" name="cardnumber" id="cardnumber" maxlength="16" value="{$smarty.post.cardnumber}" /></dd>
            <section class="clear"></section>
        </dl>
 
       	<dl class="space10">
        	<dt>Security Code</dt>
            <dd><input type="text" class="input10" name="cardcode" id="cardcode"  maxlength="4"  value="{$smarty.post.cardcode}" /></dd>            
            <section class="clear"></section>
            
            <div style="color:#F00;" id="scode_msg"></div>
        </dl>
        <dl class="space40">
        	<dt>Expiration Date</dt>
            <dd>
             <section class="select_box_container">
                <select class="select Rmargin15" name="cardmonth" id="cardmonth">
                	<option value="">Select Month</option>
                    {section name=k start=1 loop=13 step=1}
		                <option value="{$smarty.section.k.index|str_pad:2:"0":$smarty.const.STR_PAD_LEFT}" {if $smarty.post.cardmonth == $smarty.section.k.index|str_pad:2:"0":$smarty.const.STR_PAD_LEFT} selected="selected" {/if}>{$smarty.section.k.index|str_pad:2:"0":$smarty.const.STR_PAD_LEFT}</option>
                    {/section}
                </select>
            </section>
             <section class="select_box_container">    
                <select class="select Rmargin15" name="carddate" id="carddate">
                	<option value="">Select Year</option>
                    {section name=yr loop=$yr_arr}
	                    <option value="{$yr_arr[yr]}" {if $smarty.post.carddate == $yr_arr[yr]} selected="selected" {/if}>{$yr_arr[yr]}</option>
                    {/section}
                </select>
             </section>   
            </dd>
            <div id="date_error" style="color:#F00;"></div> 
            <section class="clear"></section>
        </dl>
    
        <dl>
        	<dt>Cardholder Name</dt>
            <dd><input type="text" class="input" name="card_holder" id="card_holder" value="{$smarty.post.card_holder}" maxlength="20" /></dd>
            <section class="clear"></section>
        </dl>
   
            </div>
         
         </div>
         {/if} 
         
        <section class="clear"></section>
        {if $nab.published eq 1 || $paypal.published eq 1}
        
        <div style="border-bottom:1px dotted #6BC3E6; margin-top: 20px;"></div>
        <dl>
        	<dt>&nbsp;</dt>
            <dd>
             <input type="hidden" name="btnstep4" id="btnstep4" value=""  />
    		 <input type="button" onclick="return validateFrm();"  value="Submit" class="blue_btn" > &nbsp;&nbsp;<input type="button" onclick="window.location.href='{$siteroot}/leads/'"  value="Cancel" class="blue_btn" > 
    	    </dd>
        </dl>
        {else}
        	<p>No Payment method !!!</p>
        {/if}
        <section class="clear"></section>
    </section>
    <section class="clear"></section>

    </form>

    </section>
</section>

{include file=$footer}
